<?php
$this->breadcrumbs=array(
	Yii::t('user','Quản lý tài khoản')=>array('/user/profile'),
	Yii::t('user','Cập nhật thông tin'),
);?>

<style type="text/css">#files{display:none;}</style>
<h1><?php echo Yii::t('user','Cập nhật thông tin') ?></h1>

<div class="right">
	<div class='alc'>
		<?php
		echo CHtml::image($model->avatar_path, $model->name, array('id'=>'avatar-holder'));

		$this->widget('ext.xupload.XUploadWidget', array(
			'url' => $this->createUrl("changeAvatar"),
			'uploadButtonLabel'=>Yii::t('user','Đổi hình đại diện'),
			'model' => new XUploadForm,
			'attribute' => 'avatar',
			'multiple'=>true,
			'options'=>array(
				'dropZone'=>'js:$()',
				'onComplete'=>'js:function(event, files, index, xhr, handler, callBack){
					data = $.parseJSON(xhr.responseText);
					$("#avatar-holder").attr("src",data.thumbnail);
				}'
			)
		));
		?>
	</div>	

	<div class='mtm'>
		<strong><?php echo CHtml::activeLabel($model,'name'); ?>:</strong>
		<?php echo $model->name; ?>
	</div>

	<div>
		<strong><?php echo CHtml::activeLabel($model,'group_id'); ?>:</strong>
		<?php echo $model->group->name; ?>
	</div>
	<div>
		<strong><?php echo CHtml::activeLabel($model,'join_date'); ?>:</strong>
		<?php echo app()->format->formatDate($model->join_date) ?>
	</div>
</div>
<div class="left form wide">
	
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'user-update-form',
	'enableAjaxValidation'=>false,
)); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'first_name'); ?>
		<?php echo $form->textField($model,'first_name',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'first_name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'last_name'); ?>
		<?php echo $form->textField($model,'last_name',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'last_name'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'email'); ?>
		<?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>100)); ?>
		<?php echo $form->error($model,'email'); ?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'username'); ?>
		<?php echo $form->textField($model,'username') ?>
		<?php echo $form->error($model,'username'); ?>
	</div>
		
	<div class="row buttons">
		<?php echo CHtml::submitButton(Yii::t('user','Cập nhật'), array('class'=>'g-button g-button-submit')); ?>
		<?php echo CHtml::resetButton(Yii::t('user','Hủy thay đổi'), array('class'=>'g-button')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
